Skip to content

Qt6 (QGIS 4) compatibility #1036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 10, 2025
Merged

Qt6 (QGIS 4) compatibility #1036

merged 11 commits into from
Jul 10, 2025

Conversation

signedav
Copy link
Member

@signedav signedav commented Jun 16, 2025

Qt6 upgrade performed by pyqgis4-checker:

docker run -it --rm -v /home/dave/dev/opengisch/QgisModelBaker:/home/pyqgisdev/ registry.gitlab.com/oslandia/qgis/pyqgis-4-checker/pyqgis-qt-checker:latest pyqt5_to_pyqt6.py --logfile /home/pyqgisdev/pyqt6_checker.log .

See https://github.com/qgis/QGIS/wiki/Plugin-migration-to-be-compatible-with-Qt5-and-Qt6 and https://github.com/qgis/pyqgis4-checker

Requires opengisch/QgisModelBakerLibrary#144

For big parts this resolves #985

Manual checks

Test manually

Docker approach

docker build --pull --rm -f qgis-qt6-unstable.dockerfile     --progress=plain     --build-arg QGIS_GIT_VERSION=master     -t qgis-qt6-unstable:local .

and:

xhost +local:docker

and:

docker run -it --rm   -e DISPLAY=$DISPLAY   -e LC_ALL=C.utf8   -e LANG=C.utf8   -v /tmp/.X11-unix:/tmp/.X11-unix     -v /home/dave/.local/share/QGIS/QGIS3/profiles/modelbaker:/home/quser/.local/share/QGIS/QGIS3/profiles/default qgis-qt6-unstable:local   qgis

with:

-v /home/dave/.local/share/QGIS/QGIS3/profiles/modelbaker:/home/quser/.local/share/QGIS/QGIS3/profiles/default

but does not work

Flatpack approach

Got flatpack from http://duif.net/qgis-qt6.flatpak

And this works...

Results

  • Deprecated FollowREdirectsattribute mode -> could be skipped when Qt6 (but not with Qt5)

  • setFilterRegularExpression replaces setFilterRegExp

  • The gui is f... up. Sizes are not correct. (Test here on the other computer) was only the case with my weird laptop that as issues anyway

  • Could not test Java interaction with flat pack (it says no java is installed)
    I tried to install Java flatpak and pass this --env=JAVA_HOME=/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.openjdk but made no difference

  • Could not gather models from repo:
    And it says Warning: Qt: Session management error: Could not open network socket
    I tried to pass this to the flatpak --device=all --filesystem=host --share=network but made no difference

  • Do we need to support Qt < 5.12? (if so,then we need setFilterRegExp)

@signedav signedav requested a review from gacarrillor June 30, 2025 12:13
@signedav
Copy link
Member Author

@gacarrillor Do you think we could ignore that java and network is not working with the flatpak?

Btw. I receive this message on starting it Warning: Qt: Session management error: Could not open network socket Any idea?

Qt.DockWidgetArea(
settings.value(
"QgisModelBaker/validate_dock/area",
2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like Qt.DockWidgetArea.RightDockWidgetArea instead of 2 to be more explicit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has a problem with that. Tells me it's not an integer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work on your flatpak instance:

QSettings().value("QgisModelBaker/validate_dock/area", Qt.DockWidgetArea.RightDockWidgetArea, type=int)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... Have to check that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work on your flatpak instance:

QSettings().value("QgisModelBaker/validate_dock/area", Qt.DockWidgetArea.RightDockWidgetArea, type=int)

TypeError: QgisInterface.addDockWidget(): argument 1 has unexpected type 'int'

And when I do this:

QSettings().value("QgisModelBaker/validate_dock/area", Qt.DockWidgetArea.RightDockWidgetArea, type=Qt.DockWidgetArea),

TypeError: unable to convert a QVariant of type 10 to a QMetaType of type 65858

That's why I decided to read it as integer and cast then...

In Qt6 we could at least take Qt.DockWidgetArea.RightDockWidgetArea.value instead of 2 but this would not work with Qt5... 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@signedav, I think we forgot this one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but I forgot to submit my review comments. See above...

@gacarrillor
Copy link
Member

gacarrillor commented Jul 1, 2025

@gacarrillor Do you think we could ignore that java and network is not working with the flatpak?

Btw. I receive this message on starting it Warning: Qt: Session management error: Could not open network socket Any idea?

@signedav, if the flatpak build is not letting us fully test MB, I guess we could try these changes on a Windows build with support for Qt6. Do you have access to a Windows machine? If not, I could give it a try by the end of this week.

@signedav
Copy link
Member Author

signedav commented Jul 1, 2025

Do you have access to a Windows machine? If not, I could give it a try by the end of this week.

This would be great.

@gacarrillor
Copy link
Member

Do you have access to a Windows machine? If not, I could give it a try by the end of this week.

This would be great.

Before that, I'd appreciate if you can upload a zipped dev version of the plugin somewhere.
Also, if you'd like that I test some particular module or case, just let me know.

@signedav
Copy link
Member Author

signedav commented Jul 2, 2025

Off today. I'll do it tomorrow.

signedav added 9 commits July 3, 2025 09:47
docker run -it --rm -v /home/dave/dev/opengisch/QgisModelBaker:/home/pyqgisdev/ registry.gitlab.com/oslandia/qgis/pyqgis-4-checker/pyqgis-qt-checker:latest pyqt5_to_pyqt6.py --logfile /home/pyqgisdev/pyqt6_checker.log .
For big parts this resolves #985
Copy link
Contributor

github-actions bot commented Jul 3, 2025

🧁 Ta-daaa, find a test ZIP of bd0a3fc here.

@signedav
Copy link
Member Author

signedav commented Jul 3, 2025

@gacarrillor Can you test with the zip here #1036 (comment)

@gacarrillor
Copy link
Member

gacarrillor commented Jul 4, 2025

Manual Tests for Qt6 on Windows:

WIZARD

  • The list of models is not displayed when entering any search string (e.g. nutz).

    • This message is shown in the QGIS Log Message Viewer (modelbaker tab):
      2025-07-04T16:42:46 WARNING There was an error connecting to the database. Check connection parameters. Error details: connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied

Project Generation

  • It works!

ili2db

  • Downloading ili2db I got this error (actually, even on Ubuntu it's often the case that I have to install libs manually, because of strange errors: a timeout, if I remember correctly):

     > ---------- Schema Import Configuration
     > ---------- Schema Import Sessions
    Downloading ili2pg version 5.3.1…
    .
    .
    .
    .
    Could not download ili2pg
    
      Error: Unknown error
    
    File "C:\Users\user\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\QgisModelBaker\libs\modelbaker\iliwrapper\bin\ili2pg-5.3.1\ili2pg-5.3.1.jar" not found. Please download and extract <a href="https://downloads.interlis.ch/ili2pg/ili2pg-5.3.1.zip">ili2pg</a>
    

SCHEMA IMPORT

  • On GPKG, all OK, including baskets and OIDs.

  • On PostGIS:

    • I've stumbled upon this bug, which also occurs in Qt5.
    • With a proper model and connection, and having ilid2db libs installed, it worked fine.

DATA IMPORT

  • It works!

DATA EXPORT

  • It works!

VALIDATOR

  • It works!

BASKETS/DATASETS

  • Worked fine, but got several messages like these in the Log Message Viewer (Messages tab). Note that I used a QGIS dev build, so debug was enabled:
    2025-07-04T16:39:50     CRITICAL    Qt : beginResetModel called on BasketSourceModel(0x284f552f970) without calling endResetModel first
    2025-07-04T16:39:50     CRITICAL    Qt : beginResetModel called on QSortFilterProxyModel(0x284f1554f20) without calling endResetModel first
    2025-07-04T16:39:50     CRITICAL    Qt : endResetModel called on BasketSourceModel(0x284f552f970) without calling beginResetModel first
    2025-07-04T16:39:50     CRITICAL    Qt : endResetModel called on QSortFilterProxyModel(0x284f1554f20) without calling beginResetModel first
  • When changing the Dataset of a specific basket in the Basket Manager (Layers were in Edit model), we've got an error message (I guess it's expected, but then we could disable the edit buttons in Dataset and Basket Managers if layers are on edit mode):

    image

    I attempted the same edit operation with layers in non-edit mode, and then it worked!

QUICK VISUALIZER

  • It works!

@signedav
Copy link
Member Author

signedav commented Jul 4, 2025

Cool, thanks for testing.

Am I right that the network issue (listing of models and ili2db download) happens on Qt6 only and the others as well on the current QGIS release?

If so we should solve the Qt6 in a first step and check the others independently.

@gacarrillor
Copy link
Member

Am I right that the network issue (listing of models and ili2db download) happens on Qt6 only and the others as well on the current QGIS release?

I've experienced the ili2db download issues on Qt5. Actually, I think I'm used to install those libs manually.
The listing of models is a Qt6 thing, yes.

@signedav
Copy link
Member Author

signedav commented Jul 5, 2025

Okay, since the listing of models is reproducible by flatpak I'll check this out.

Would you mind to create separate issues for the other problems? Except the thing with ili2db download. I think this is a problem with the server. And we cannot solve it since we are not allowed to ship java code in plugins AFAIK.

@gacarrillor
Copy link
Member

Would you mind to create separate issues for the other problems? Except the thing with ili2db download. I think this is a problem with the server. And we cannot solve it since we are not allowed to ship java code in plugins AFAIK.

Done at #1041 and #1042. I was unable to reproduce them using a Qt5-build on GNU/Linux. Therefore, I marked them as Qt6-only.

@signedav
Copy link
Member Author

signedav commented Jul 8, 2025

This message is shown in the QGIS Log Message Viewer (modelbaker tab): 2025-07-04T16:42:46 WARNING There was an error connecting to the database. Check connection parameters. Error details: connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied

Minor thing. See #1043

@signedav
Copy link
Member Author

signedav commented Jul 8, 2025

@signedav
Copy link
Member Author

signedav commented Jul 8, 2025

Okay, when I merge it and we publish an experimental soonish?

@signedav signedav merged commit 1d8b17b into master Jul 10, 2025
8 checks passed
@signedav signedav deleted the qt6 branch July 10, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ensure Qt6 compatibility
2 participants